xend: Fix VDI-VBD link for XenAPI
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 9 Oct 2009 07:56:43 +0000 (08:56 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 9 Oct 2009 07:56:43 +0000 (08:56 +0100)
commit2f42a37e5769b63a6f4f0eb6471288793cc4f4db
treedd1f68b3a13ac19c58cacd830649e343a563edbe
parenta60d80e39ee2c0656851fe2de4cd8cbe93fbde9d
xend: Fix VDI-VBD link for XenAPI

I detected problems of VDI-VBD link again.
  - In the case of inactive managed domains, VDI->VBD link was lost
    by xend restarting (or host OS rebooting).
  - In the case of active domains, both VDI->VBD link and VBD->VDI
    link were lost by xend restarting.

When xend is restarted, information of VDI instances is restored from
a vdi.xml file.  But the vdi.xml file does not have UUID of VBD
because xend does not write the UUID to the vdi.xml file.  Therefore,
VDI->VBD link is lost.  When xend is restarted, information of VBD
instances is restored from xenstore.  But xenstore does not have UUID
of VDI.  Therefore, VBD->VDI link is lost.

This patch solves the problems.  VDI instances stop having UUID of
VBD.  Instead, xend gathers UUID of VBD each time it's required.  The
method is the same as Network->VIF link.  Information of VBD instances
is restored not only from xenstore but from a config.sxp file.  UUID
of VDI is restored from the config.sxp file.

FYI, VBD->VDI link of inactive managed domains is not lost because
information of VBD instances is restored from the config.sxp file.
UUID of VDI is written by xend to the config.sxp file.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
tools/python/xen/xend/XendAPI.py
tools/python/xen/xend/XendDomain.py
tools/python/xen/xend/XendDomainInfo.py
tools/python/xen/xend/XendVDI.py